<!--操作日志-->
<template>
  <div class="base-log">
    <!-- 操作日志查询条件筛选 -->
    <div class="base-operate">
      <a-form-model :label-col="{ span: 4 }" :wrapper-col="{ span: 18 }">
        <a-row>
          <a-col :span="16">
            <a-row>
              <a-col :span="12">
                <a-form-model-item label="操作人">
                  <a-select placeholder="请选择操作人" style="width: 100%;">
                    <a-select-option value="1">admin</a-select-option>
                    <a-select-option value="2">test</a-select-option>
                    <a-select-option value="3">aaa</a-select-option>
                    <a-select-option value="4">bbb</a-select-option>
                  </a-select>
                </a-form-model-item>
              </a-col>
              <a-col :span="12">
                <a-form-model-item label="操作类型">
                  <a-select placeholder="请选择操作类型" style="width: 100%;">
                    <a-select-option value="1">新增</a-select-option>
                    <a-select-option value="2">删除</a-select-option>
                    <a-select-option value="3">修改</a-select-option>
                    <a-select-option value="4">查询</a-select-option>
                    <a-select-option value="5">登录</a-select-option>
                  </a-select>
                </a-form-model-item>
              </a-col>
            </a-row>
            <a-row>
              <a-col :span="12">
                <a-form-model-item label="操作时间">
                  <a-range-picker style="width: 100%;" />
                </a-form-model-item>
              </a-col>
              <a-col :span="12">
                <a-form-model-item label="操作内容">
                  <a-input placeholder="请输入查询内容" />
                </a-form-model-item>
              </a-col>
            </a-row>
          </a-col>
          <a-col :span="8">
            <a-form-model-item>
              <a-button type="primary" icon="filter" class="icon-button">筛选</a-button>
              <a-button type="primary" icon="rest">重置</a-button>
            </a-form-model-item>
          </a-col>
        </a-row>
      </a-form-model>
    </div>
    <!-- 操作日志表格 -->
    <el-table
      :data="baseTableData"
      highlight-current-row
      border
      height="calc(100% - 140px)"
      :row-style="{height:'40px'}"
      :cell-style="{padding:'0px'}"
      :header-cell-style="{background: '#FAFAFA', padding: 0, height: '40px', color: '#666666'}"
      style="width: 100%">
      <slot v-for="(item,index) in baseColumns">
        <el-table-column
          v-if="item.field!=='Log_Type'"
          :key="index"
          :property="item.field"
          :label="item.title"
          :width="item.width"
          show-overflow-tooltip
          sortable>
        </el-table-column>
        <el-table-column
          v-if="item.field==='Log_Type'"
          :key="index"
          :property="item.field"
          :label="item.title"
          :width="item.width"
          show-overflow-tooltip
          sortable>
          <template slot-scope="scope">
            <a-tag v-if="scope.row.Log_Type==='add'" color="blue">新增</a-tag>
            <a-tag v-else-if="scope.row.Log_Type==='edit'" color="orange">修改</a-tag>
            <a-tag v-else-if="scope.row.Log_Type==='delete'" color="red">删除</a-tag>
          </template>
        </el-table-column>
      </slot>
    </el-table>
    <!-- 操作日志分页 -->
    <div class="pagination">
      <a-pagination :total="50" show-size-changer show-quick-jumper />
    </div>
  </div>
</template>

<script>
export default {
  name: 'BaseLog',
  components: {
  },
  data () {
    return {
      baseTableData: [
        {
          Log_Time: '2020-05-27',
          Log_Type: 'add',
          Log_Man: 'test',
          Log_Content: '新增字段定义',
          Log_Path: 'table/column',
          Log_IP: '1'
        },
        {
          Log_Time: '2020-05-28',
          Log_Type: 'edit',
          Log_Man: 'admin',
          Log_Content: '编辑字段定义',
          Log_Path: 'table/column',
          Log_IP: '2'
        },
        {
          Log_Time: '2020-05-28',
          Log_Type: 'delete',
          Log_Man: 'admin',
          Log_Content: '删除字段定义',
          Log_Path: 'table/column',
          Log_IP: '3'
        }
      ],
      baseColumns: [
        {
          title: '时间',
          field: 'Log_Time'
        },
        {
          title: '类型',
          field: 'Log_Type'
        },
        {
          title: '操作人',
          field: 'Log_Man'
        },
        {
          title: '内容',
          field: 'Log_Content'
        },
        {
          title: '路径',
          field: 'Log_Path'
        },
        {
          title: 'IP地址',
          field: 'Log_IP'
        }
      ]
    }
  },
  created () {
  },
  mounted () {
  },
  methods: {
  }
}
</script>
<style lang="less" scoped>
.base-log {
  width: 100%;
  height: 100%;
  padding: 10px 10px 0;
  background: #f0f2f5;
  .base-operate {
    height: 100px;
    background: #fff;
    padding: 10px 0;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    .ant-row {
      .ant-form-item {
        margin-bottom: 0;
      }
    }
  }
  .pagination {
    height: 40px;
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: flex-end;
  }
}
</style>
